#ifndef LINESVIEWER_H
#define LINESVIEWER_H

#include <QGraphicsView>
#include <QTimer>
#include "line.h"

#define WIDTH  1024
#define HEIGHT 600

class LinesViewer : public QObject
{
    Q_OBJECT
public:
    LinesViewer( QObject * parent = 0 );
public slots:
    void addNewLine()
    {
        Line * myLine = new Line( WIDTH, HEIGHT, 2, QThread::currentThread() );
        scene.addItem( myLine );
        myLine->start();
        QTimer::singleShot( (int) ExpArrival::newArrival( 0.001 ),
                            this, SLOT(addNewLine()) );
    }
    void updateView()
    {
        scene.update();
        viewer.update();
    }

private:
    QGraphicsScene scene;
    QGraphicsView viewer;
};

#endif // LINESVIEWER_H
